package com.welink.cmp.dao.vender;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.welink.cmp.dto.vendor.AccountListByPageQry;
import org.springframework.stereotype.Component;

/**
 * VendorAccount Dao Service
 * 提供维护账户的CRUD操作
 *
 * @author yanwei li
 * @create 2024-05-20 21:23
 */
@Component
public class VendorAccountDaoService extends ServiceImpl<VendorAccountMapper, VendorAccountDO> {


    public Page<VendorAccountDO> pageQry(AccountListByPageQry pageQry){
        Page<VendorAccountDO> page = new Page<>(pageQry.getPageIndex(),pageQry.getPageSize());
        LambdaQueryWrapper<VendorAccountDO> wrapper = new LambdaQueryWrapper<>();
        if (pageQry.getVendor() != null) {
            wrapper.eq(VendorAccountDO::getVendor,pageQry.getVendor());
        }
        if (pageQry.getStrCreateTime() !=null){
            wrapper.ge(VendorAccountDO::getCreateTime,pageQry.getStrCreateTime());
        }
        if (pageQry.getEndCreateTime() != null){
            wrapper.le(VendorAccountDO::getCreateTime,pageQry.getEndCreateTime());
        }
        return this.page(page, wrapper);
    }

}